/**********************************************************************
 * LeechCraft - modular cross-platform feature rich internet client.
 * Copyright (C) 2006-2014  Georg Rudoy
 *
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
 **********************************************************************/

#pragma once

#include <QObject>
#include <QMenu>
#include <sailmipim/iinfo.h>
#include <sailmipim/iplugin2.h>
#include <sailmipim/ihavetabs.h>
#include <sailmipim/ijobholder.h>
#include <sailmipim/core/ihookproxy.h>
#include <sailmipim/multiplayer/IMultiPlayerPlugin.h>

namespace SailmiPIM
{
namespace Plugin::MultiPlayer
{
	struct MediaInfo;
}
}

namespace SailmiPIM
{
namespace Plugin::MultiPlayer
{
namespace Graffiti
{
	class ProgressManager;
	class GraffitiTab;

	class Plugin : public QObject
				 , public IInfo
				 , public IPlugin2
				 , public IHaveTabs
				 , public IJobHolder
				 , public IMultiPlayerPlugin
	{
		Q_OBJECT
		Q_INTERFACES (IInfo
				IPlugin2
				IHaveTabs
				IJobHolder
				SailmiPIM::Plugin::MultiPlayer::IMultiPlayerPlugin)

		SAILMIPIM_PLUGIN_METADATA ("com.sailmi.pim.plugin.MultiPlayer.Graffiti")

		IMultiPlayerProxy_ptr MultiPlayerProxy_;

		TabClassInfo TaggerTC_;

		ProgressManager *ProgressMgr_;
	public:
		void Init (ICoreProxy_ptr) override;
		void SecondInit () override;
		void Release () override;
		QByteArray GetUniqueID () const override;
		QString GetName () const override;
		QString GetInfo () const override;
		QIcon GetIcon () const override;

		QSet<QByteArray> GetPluginClasses () const override;

		TabClasses_t GetTabClasses () const override;
		void TabOpenRequested (const QByteArray& tabClass) override;

		QAbstractItemModel* GetRepresentation () const override;

		void SetMultiPlayerProxy (IMultiPlayerProxy_ptr) override;
	private:
		GraffitiTab* MakeTab ();
	public slots:
		void hookPlaylistContextMenuRequested (SailmiPIM::IHookProxy_ptr,
				QMenu*,
				const SailmiPIM::Plugin::MultiPlayer::MediaInfo&);
		void hookCollectionContextMenuRequested (SailmiPIM::IHookProxy_ptr,
				QMenu*,
				const SailmiPIM::Plugin::MultiPlayer::MediaInfo&);
	};
}
}
}
